package com.jc.camerascan.adapter;

import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jc.camerascan.R;
import com.jc.camerascan.entity.AdvancedResult;
import com.jc.camerascan.entity.HomeMenu;

/**
 * @ProjectName: PhotoRecognition
 * @Package: com.jc.camerascan.adapter
 * @ClassName: ScanResultOneAdapter
 * @Description: java类作用描述
 * @Author: XuChi
 * @CreateDate: 2020/7/15 19:18
 * @Version: 1.0
 */
public class ScanResultOneAdapter extends BaseQuickAdapter<AdvancedResult.ResultBean, BaseViewHolder> {

    public ScanResultOneAdapter() {
        super(R.layout.item_scan_result_one);
    }

    @Override
    protected void convert(BaseViewHolder helper, AdvancedResult.ResultBean item) {
        helper.setText(R.id.name, item.getKeyword());
        TextView score = helper.getView(R.id.score);
        TextView des = helper.getView(R.id.des);
        TextView line = helper.getView(R.id.line);

        score.setText("相似度：" + (int) (item.getScore() * 100) + "％");
        if (item.getBaike_info() != null && item.getBaike_info().getDescription() != null && !item.getBaike_info().getDescription().isEmpty()) {
            des.setText(item.getBaike_info().getDescription());
            des.setVisibility(View.VISIBLE);
        } else {
            des.setVisibility(View.GONE);
        }
    }
}

